package com.azthink.chapter423.controller;

import com.azthink.chapter423.utils.ResultGenerator;
import com.azthink.chapter423.vo.Result;
import com.azthink.chapter423.vo.UserModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user")
public class UserController extends BaseCotroller{
    private Logger logger = LoggerFactory.getLogger(UserController.class);

    @GetMapping("/aa")
    public Result aa(){
        int a = 2;
        int b = 0;
        int c = a / b;
        System.out.println(c);
        return ResultGenerator.ok("Hello, "+ c);
    }

    public Result<UserModel> login(UserModel userModel){
        logger.debug("username = {}, password = {}", userModel.getUsername(), userModel.getPassword());
        return ResultGenerator.ok(userModel);
    }
}
